import request from "./request";

//员工分类
export class StaffListApi {

    getStaffList({page, search}) {
        let data = {page, search}
        return request({url: '/api/v1/org/staff/list', method: 'post', data})
    }

    getStaffDetail(staff_id) {
        let data = {staff_id}
        return request({url: '/api/v1/org/staff/detail', method: 'post', data, loading: false})
    }

    //学历列表接口
    getEduList() {
        return request({url: '/api/v1/org/staff/edus', method: 'get'})
    }

    updateStaff({id, status}) {
        //人事状态：0离职1在职
        let data = {staff_id: id, status,}
        return request({url: '/api/v1/org/staff/edit', method: 'post', data})
    }
}

//添加员工
export class AddStaffApi {
    addStaff({avatar, name, sex, age, jobs, edu, username, id_card, entry_time, status, address}) {
        //性别：1男2女0未知  岗位数组:[{“id”:1},{“id”:2}]  人事状态：0离职1在职
        let data = {avatar, name, sex, age, jobs, edu, username, id_card, entry_time, status, address}
        return request({url: '/api/v1/org/staff/create', method: 'post', data})
    }

    updateStaff({id, avatar, name, sex, age, jobs, edu, username, id_card, entry_time, status, address}) {
        //性别：1男2女0未知  岗位数组:[{“id”:1},{“id”:2}]  人事状态：0离职1在职
        let data = {staff_id: id, avatar, name, sex, age, jobs, edu, username, id_card, entry_time, status, address}
        return request({url: '/api/v1/org/staff/edit', method: 'post', data})
    }

    //岗位列表接口
    getJobsList() {
        return request({url: '/api/v1/org/staff/jobs', method: 'get'})
    }

    //学历列表接口
    getEduList() {
        return request({url: '/api/v1/org/staff/edus', method: 'get'})
    }
}
